package com.zhentao.controller;

import com.zhentao.pojo.Doctor;
import com.zhentao.service.DepartmentService;
import com.zhentao.service.DepartmentSonService;
import com.zhentao.service.DoctorService;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/department")
public class DepartmentController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private DepartmentService departmentService;

    @Autowired
    private DepartmentSonService departmentSonService;

    @RequestMapping("list")
    public Result list() {
        return Result.OK(departmentService.list());
    }

    @RequestMapping("findAllDepart")
    public Result findAllDepart() {
        return Result.OK(departmentSonService.list());
    }

    @RequestMapping("getTypeById")
    public Result getById(@RequestParam("deid") Integer id) {
        List<Doctor> list = doctorService.getTypeById(id);
        return Result.OK(list);
    }




}
